package com.guanyong.webapi.controllers.page;

import com.guanyong.webapi.handle.UserHandle;
import com.guanyong.model.FuncModel;
import com.guanyong.model.RoleModel;
import com.guanyong.model.UserBaseModel;
import com.guanyong.services.FuncService;
import com.guanyong.services.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by Eric.Zhang on 2017/4/12.
 */
public class baseController {


    @Autowired
    UserHandle userHandle;
    @Autowired
    RoleService roleService;
    @Autowired
    FuncService funcService;

    UserBaseModel base_userEntity;

    @ModelAttribute
    public void   noaction(Model model,  HttpServletRequest request) {
        UserBaseModel userBaseModel=userHandle.getCurUser(request);
        if (userBaseModel!=null){
            model.addAttribute("userbaseinfo",userBaseModel);
            base_userEntity = userBaseModel;
            model.addAttribute("loginstate","login");
        }
        else{
            UserBaseModel userBaseModel1=new UserBaseModel()
                    ;
            model.addAttribute("userbaseinfo",userBaseModel1);
            model.addAttribute("loginstate","nologin");
        }
    }
}
